package com.ehualu.getes.until;

import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.search.SearchHit;

import java.util.HashMap;
import java.util.Map;

public class EsUtilTest {
    public static void main(String[] args) {
        String host = "37.158.97.130,37.158.97.131,37.158.97.132";
        int port = 24148;
        String schema = "http";


        ESClientbui esClientbui = new ESClientbui();
        RestHighLevelClient client = esClientbui.getHighLevelClient(host, port, schema);

        OracleUtills oracleUtills = new OracleUtills();
        Fenworduntil fenworduntil = new Fenworduntil();

        ESguaUntil eSguaUntil = new ESguaUntil();

        TimeUntil timeUntil = new TimeUntil();
//        得到返回集合
//        SearchHit[] searchHitstop = eSguaUntil.getguokkidtopSearchHit(index, guahoucarnum, gcfw, client);
//        System.out.println("根据挂车车尾号牌得到前N条 条数：" + searchHitstop.length);


//        ESsdUntil eSsdUntil = new ESsdUntil();

//        eSsdUntil.getgcjl("2019-11-02T09:30:23.000Z", "2019-11-02T10:00:23.000Z", "guoche_201911", "3715010111626", client);


        esClientbui.close(client);

        //        EsStaticUtil.getshij2("2019-11-02T09:45:23.000Z", "2019-11-02T09:50:23.000Z", "guoche_201911", "3715010111626");


//        EsUtil esUtil=new EsUtil();


        //获取客户端
//        RestHighLevelClient client = esUtil.getHighLevelClient(host, port, schema);


//        Map<String, Integer> map = new HashMap<>();
//
//
//        Map<String, String[]> dldmmap = new HashMap<>();
//
//        String G105dlbhsz[] = new String[]{"48288", "48198", "48181", "48229", "48072", "48088", "10105", "48168", "48266", "48281", "48282", "48151", "48153", "48300", "46688", "46077", "67102", "46545", "48157", "48164"};
//
//        dldmmap.put("G105", G105dlbhsz);
//
//
//        String G20dlbhsz[] = new String[]{"00020"};
//
//        dldmmap.put("G20", G20dlbhsz);
//
////       卡口 5
//        String G308dlbhsz[] = new String[]{"48078", "48077", "48200", "10308", "48140", "48161", "48205", "48212"};
//
//        dldmmap.put("G308",G308dlbhsz);
//
//        String G106dlbhsz[] = new String[]{"10106", "43927"};
//        dldmmap.put("G106",G106dlbhsz);
//
//        String G309dlbhsz[] = new String[]{"43109", "10309", "43985", "43125"};
//
//        dldmmap.put("G309",G309dlbhsz);
//


//        esUtil.getGliuluntil("guoche_201911", "1573541353799", "g20", "由东向西", map, client);
//
////        EsUtil.getGliuluntilforh();
//        esUtil.close(client);


//        EsStaticUtil.creclient(host, port, schema);
//        EsStaticUtil.getshij2("2019-11-02T09:45:23.000Z", "2019-11-02T09:50:23.000Z", "guoche_201911", "3715010111626");
//        EsStaticUtil.close();
//

//        boolean flog = EsUtil.checkIndexExist(client, "es_index");
//        System.out.println(flog);
//        HashMap<String, String> map = new HashMap<>();
//        map.put("name","wzh");
//        map.put("city","beijing");
//        map.put("sex","men");
//        //插入数据
//        EsUtil.addData(client,"es_index","user","51",map);
//        //查询数据
//        String s = EsUtil.queryByMatch("es_flink2", "user", "city","beijing", client);
//        System.out.println("结果数据"+s);
//        EsUtil.close;
    }
}
